package com.sy.service.impl;

import com.sy.dto.CoachSubDto;
import com.sy.entity.AdminUser;
import com.sy.entity.Coach;
import com.sy.mapper.CoachMapper;
import com.sy.service.CoachService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CoachServiceImpl implements CoachService {
    @Autowired
    private CoachMapper coachMapper;

    @Override
    public Coach findByLogin(Coach coach) {
        Coach loginCoach = coachMapper.selectByLogin(coach);
        return loginCoach;
    }

    @Override
    public List<Coach> findAllInfo(Coach coach) {
        List<Coach> coaches = coachMapper.selectAllInfo(coach);
        return coaches;
    }

    @Override
    public List<CoachSubDto> findAllSubjectByCoach(Coach coach) {
        List<CoachSubDto> coachSubDtoList= coachMapper.selectAllSubjectByCoach(coach);
        return coachSubDtoList;
    }

    @Override
    public boolean upDateCoach(Coach coach) {
        if (coachMapper.updateCoach(coach)>0){
            return true;
        }else {
            return false;
        }
    }
}
